<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<title>线索设置</title>
	<link rel="stylesheet" href="/layui/css/layui.css">
	<link rel="stylesheet" href="/hyqcss/public.css">
	<style type="text/css">
		body{
			background: #e9e9e9;
		}
		/*公共头部带搜索*/
		.public_container{
			margin: 20px;
			background: #fff;
		}
		.public_title_container{
			height: 54px;
			padding: 0 20px;
			font-size: 14px;
			display: flex;
			align-items: center;
			background: #f9f9f9;
			border-bottom: 1px solid #f0f0f0;
		}
		.public_title_container a{
			padding: 16px 10px;
			border-bottom: 2px solid #f9f9f9;
		}
		.public_title_container .active{
			color: #1890ff;
			border-bottom: 2px solid #1890ff !important;
		}
		.public_buttonSearch_container{
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 20px;
			background: #fff;
		}
		.public_buttonSearch_container a{
			color: #fff;
			background-color: #2f54eb;
			text-shadow: 0 -1px 0 rgba(0,0,0,.12);
			height: 24px;
			padding: 4px 15px;
			font-size: 14px;
			border-radius: 2px;
			display: flex;
			align-items: center;
			cursor: pointer;
		}
		.public_Search_container{
			position: relative;
		}
		.public_Search_container input{
			width: 240px;
			height: 32px;
			border: 1px solid #d9d9d9;
		}
		.public_Search_container i{
			position: absolute;
			bottom: 6px;
			right: 10px;
			cursor: pointer;
		}
		/*公共头部带搜索 end*/
		.public_table_container{
			padding: 0 20px 20px 20px;
		}

		.public_tip_container{
			margin: 20px;
		}
	</style>
</head>
<body>
	<ul class="public-header-nav">
	  <li><a href="index.html">线索管理</a></li>
	  <li><a href="sea_clue.html">线索公海</a></li>
	  <li><a href="clue_statistics.html">数据统计</a></li>
	  <li><a class="public-header-nav-active" href="setting_sea.html">设置</a></li>
	</ul>
	<div class="public_container">
		<!-- /*公共头部带搜索*/ -->
		<div class="public_content">
			<div class="public_title_container">
				<a href="javascript::viod(0)">公海列表</a>
				<a href="javascript::viod(0)" class="active">线索等级</a>
			</div>
		</div>
		<div class="public_container">
			<a href="javascript::viod(0)" class="layui-btn layui-btn-normal add_clue_level" data-id="" style="">创建线索等级</a>
		</div>
		<!-- /*公共头部带搜索*/ end -->
		<!-- 公共表格部分 -->
		<form class="layui-form">
			<div class="public_table_container">
				<table class="layui-table" lay-skin="line">
					<colgroup>
						<col width="20%">
						<col width="15%">
						<col width="15%">
						<col width="35%">
					</colgroup>
					<thead>
						<tr>
							<th>线索等级</th>
							<th>创建时间</th>
							<th>更新时间</th>
							<th>操作</th>
						</tr> 
					</thead>
					<tbody>
						{loop $culeLevels as $culeLevel}
						<tr>
							<td>{$culeLevel->name}</td>
							<td>{date("Y-m-d H:i:s", $culeLevel->ctime)}</td>
							<td>{date("Y-m-d H:i:s", $culeLevel->utime)}</td>
							<td>
								<a class="table-public-btn add_clue_level" data-id="{$culeLevel->id}">修改</a>
								<a class="table-public-btn delete-cluelevel" data-id="{$culeLevel->id}">删除</a>
							</td>
						</tr>
						{/loop}
					</tbody>
				</table>
			</div>
		</form>
		<!-- 公共表格部分 end-->
	</div>
	<script src="/cdn/jquery.js"></script>
	<script src="/layui/layui.js"></script>
	<script src="/js/ajax.js"></script>
	<script type="text/javascript">
		// 弹窗
		layui.use('layer', function(){
			var layer = layui.layer;
		}); 
		// 表单
		layui.use('form', function(){
			var form = layui.form;

		  //监听提交
		  form.on('submit(formDemo)', function(data){
		  	layer.msg(JSON.stringify(data.field));
		  	return false;
		  });
		});
		$('.add_clue_level').on('click',function(){
			let id = $(this).data('id');
			layer.open({
				type: 2,
				title: '添加线索等级',
				shadeClose: true,
				shade: 0.2,
				area: ['700px', '250px'],
				content: 'add_cluelevel.html?id='+id
			}); 
		})
		$('.delete-cluelevel').on('click',function(){
			let _this = $(this);
			let id = _this.data('id');
			layer.confirm('确定要删除该线索等级吗？', { icon: 7, title:'提示'}, function(index) {
				myAjaxPost(false, true, 'delete_cluelevel.html', { id:id}, function (resp) {
			        if (resp.status == 'success') {
			            tusi(resp.msg);
						_this.parent().parent().remove();
			        }else{
			            tusi(resp.msg);
			        }
				});
				layer.close(index);
			});
		})
	</script>
	<script type="text/javascript">
		$(".public_title_container a").click(function(e){
			if($(this).hasClass('active')) return;
			location.href = 'setting_sea.html';
		})
	</script>
</body>
</html>